Page({
  data: {
    todayCheckedHabits: 2,
    totalHabits: 5,
    pendingTodos: 4,
    completedTodos: 6,
    todayEvents: 3,
    tomorrowEvents: 2,
    userInfo: {}
  },
  
  onLoad() {
    const app = getApp()
    this.setData({
      userInfo: app.globalData.userInfo
    })
  },
  
  navigateTo(e) {
    const url = e.currentTarget.dataset.url
    wx.navigateTo({ url })
  },
  
  logout() {
    wx.showModal({
      title: '提示',
      content: '确定要退出登录吗？',
      success(res) {
        if (res.confirm) {
          // 清除登录状态
          wx.removeStorageSync('isLoggedIn')
          wx.removeStorageSync('userInfo')
          
          // 返回登录页
          wx.reLaunch({
            url: '/pages/login/login'
          })
        }
      }
    })
  }
}) 